package com.atguigu.gmall.product.controller;


import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.BaseAttrInfo;
import com.atguigu.gmall.product.service.BaseAttrInfoService;
import com.atguigu.gmall.product.service.BaseCategory1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RequestMapping("/admin/product")
@RestController
public class BaseAttrInfoController {

    @Autowired
    BaseAttrInfoService baseAttrInfoService;



    /**
     * http://api.gmall.com/admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id}
     */


    @GetMapping("/attrInfoList/{category1Id}/{category2Id}/{category3Id}")
    public Result attrInfoList(@PathVariable("category1Id") Long category1Id,
                               @PathVariable("category2Id") Long category2Id,
                               @PathVariable("category3Id") Long category3Id){

       List<BaseAttrInfo> list = baseAttrInfoService.getBaseAttrInfoByCategoryId(category1Id,category2Id,category3Id);
        return Result.ok(list);

    }
}
